package com.example.truthordare;

import java.security.PublicKey;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;

import android.widget.Button;
import android.widget.TextView;

public class Notificate extends Activity {
	static String text;
	// ArrayList<Player> players = new ArrayList<Player>();
	int lv;
	int i = 0;
	int type;

	@SuppressWarnings("unchecked")
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_notificate);
		Log.i("noti", "load ok");
		TextView textview = (TextView) findViewById(R.id.no_tv);
		Button truth = (Button) findViewById(R.id.no_truth);
		Button dare = (Button) findViewById(R.id.no_dare);
		Bundle receivebd = this.getIntent().getExtras();
		if (receivebd != null) {
			//lv = receivebd.getInt("lv");
			i = receivebd.getInt("i");
			// type = receivebd.getInt("type");
		}
		text = MainActivity.tempplayer.get(i).getPlayer();
		textview.setText(text + "\n this is time for you");
		truth.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				type = 1;
				load();
			}
		});
		dare.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				type = 2;
				load();
			}
		});
	}

	public void load() {
		Intent i = new Intent();
		// mainIntent.setClass(Notificate.this, Playgame.class);
		Bundle sendBundle = new Bundle();
		sendBundle.putInt("type", type);
		i.putExtras(sendBundle);
		//startActivity(mainIntent);
		setResult(RESULT_OK, i);
		finish();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.notificate, menu);
		return true;
	}

}
